package springboot.example.filter;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 过滤器实现（注解）
 * 拦截有问题:(测试无法过滤制定)
 * @Component
 * @WebFilter(filterName = "test" ,urlPatterns = "/11321")
 *
 */
//@Component
//@WebFilter(filterName = "test" ,urlPatterns = "/11321")
@Deprecated
public class TestFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest httpServletRequest = (HttpServletRequest) request;
        HttpServletResponse httpServletResponse = (HttpServletResponse) response;
        System.out.println("filter getStudent ");
        chain.doFilter(httpServletRequest,httpServletResponse);
    }

    @Override
    public void destroy() {

    }
}
